package com.sky.controller.user;

import com.sky.CategoryService;
import com.sky.entity.Category;
import com.sky.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("user/category")
public class UserCategoryController {
    @Autowired
    CategoryService categoryService;
    /**
     * 用户端查询分类列表
     * */

    @GetMapping("/list")
    public Result list(@RequestParam(value = "type",required = false) Integer type){
        List<Category> list = categoryService.list(null, type);
        return Result.success(list);


    }

}
